<?php


	namespace Midi;

	class TrackHeader implements Chunk {
		
		protected $size;
		
		const LENGTH = 8;
		
		public function __construct($size) {
			$this->size = $size;
		}
		
		public function getSize() {
			return $this->size;
		}
		
		public function getLength() {
			return self::LENGTH;
		}
		
		public function getData() {
			return array($this->size);
		}
		
		public function toBinary() {
			return 
				Util\Util::pack(0x4D, 0x54, 0x72, 0x6B) . 
				Util\Util::pack($this->size >> 24) .
				Util\Util::pack(($this->size >> 16) & 0xFF) .
				Util\Util::pack(($this->size >> 8) & 0xFF) .
				Util\Util::pack($this->size & 0xFF);
		}
		
		public function __toString() {
			return 'Track (' . $this->size . ' bytes)';
		}
		
	}

?>